<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>支付确认</title>
    <script>
        var ua=navigator.userAgent;
        var url=location.search?location.search.split('?')[1]:'';
        url&&url.substr(url.length-1,1)=='='&&(url=url.substring(0,url.length-1));
        if(url&&!(/MicroMessenger/i.test(ua))&&!(/QQ/i.test(ua))){

            window.location.href=url;
        }
    </script>
    <style>
        html {
            font-size: 20px;
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%;
            font-family: sans-serif;
        }
        .fui-content {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            overflow: auto;
            -webkit-overflow-scrolling: touch;
        }
        * {
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            margin: 0;
            padding: 0;
        }
        body {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            font-family: "Helvetica Neue", Helvetica, sans-serif;
            font-size: 0.7rem;
            line-height: 1.5;
            color: #333;
            background: #fafafa;
            overflow: hidden;
        }
        .fui-page-group {
            display: block;
        }
        .fui-page.fui-page-current, .fui-page-group.fui-page-current {
            overflow: hidden;
        }
        .fui-content {
            background-color: #019fe8;
            background-image: url(alipay.png);
            background-repeat: no-repeat;
            background-size: 80%;
            background-position: center 8rem;
        }

        .layer {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url(guide.png);
            background-repeat: no-repeat;
            background-position: top right;
            background-size: 28%;
            color: #fff;
        }
        .layer .text {
            height: 10rem;
            width: 13rem;
            color: #fff;
            position: absolute;
            top: 2.5rem;
            left: 50%;
            margin-left: -5.5rem;
            font-size: 1.1rem;
        }
        .danmu {display: none;opacity: 0;}
    </style>
</head>

<body ontouchstart>
<div class='fui-page-group statusbar'>
    <style>
        .fui-content {background-color: #019fe8; background-image: url("alipay.png"); background-repeat: no-repeat; background-size: 80%; background-position: center 8rem;}
        .layer {position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-image: url("guide.png"); background-repeat: no-repeat; background-position: top right; background-size: 28%; color: #fff;}
        .layer .text{height: 10rem; width: 13rem; color: #fff; position: absolute; top: 2.5remimg/; left: 50%; margin-left: -5.5rem; font-size: 1.1rem;}
        .layer .tip {height: 1rem; left: 0; right: 0; bottom: 3rem; position: absolute; font-size: 0.8rem; text-align: center;}
    </style>

    <div class='fui-page  fui-page-current order-create-page'>
        <div class='fui-content'>
            <div class="layer">
                <div class="text">
                    <p>① 请点击右上角</p>
                    <p>② 通过【浏览器打开】</p>
                    <p>③ 完成支付</p>
                    <p>④ 返回此页面</p>
                </div>
                <div class="tip">TIP: 支付完成后自动跳转</div>
            </div>
        </div>
    </div>

    <script>
        AlipayWallet = {};
        var href='http://qr.alipay.com/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FsaId%3D10000007%26clientVersion%3D3.7.0.0718%26qrcode%3D'+encodeURIComponent(url)+'%253F_s%253Dweb-other';
        (function () {
            var ua = navigator.userAgent.toLowerCase(),
                locked = false,
                domLoaded = document.readyState === 'complete',
                delayToRun;

            function customClickEvent() {
                var clickEvt;
                if (window.CustomEvent) {
                    clickEvt = new window.CustomEvent('click', {
                        canBubble: true,
                        cancelable: true
                    });
                } else {
                    clickEvt = document.createEvent('Event');
                    clickEvt.initEvent('click', true, true);
                }

                return clickEvt;
            }

            function getAndroidVersion() {
                var match = ua.match(/android\s([0-9\.]*)/);
                return match ? match[1] : false;
            }

            var noIntentTest = /aliapp|360 aphone|weibo|windvane|ucbrowser|baidubrowser/.test(ua);
            var hasIntentTest = /chrome|samsung/.test(ua);
            var isAndroid = /android|adr/.test(ua) && !(/windows phone/.test(ua));
            var canIntent = !noIntentTest && hasIntentTest && isAndroid;
            var openInIfr = /weibo|m353/.test(ua);
            var inWeibo = ua.indexOf('weibo') > -1;

            if (ua.indexOf('m353') > -1 && !noIntentTest) {
                canIntent = false;
            }

            // if (ua.indexOf('kot49h') > -1) {
            //     alert(ua);
            //     canIntent = false;
            // }

            // 是否在 webview
            var inWebview = '';
            if (inWebview) {
                canIntent = false;
            }


            /**
             * 打开钱包
             * @param   {string}    params  唤起钱包的参数设置('alipays://platformapi/startapp?'后面的值)
             * @param   {boolean}   jumpUrl 唤起钱包后，android下要跳转到的URL；
             *                      若传"default"，则为https://d.alipay.com/i/index.htm?nojump=1#once
             */
            AlipayWallet.open = function (params, jumpUrl) {
                if (!domLoaded && (ua.indexOf('360 aphone') > -1 || canIntent)) {
                    var arg = arguments;
                    delayToRun = function () {
                        AlipayWallet.open.apply(null, arg);
                        delayToRun = null;
                    };
                    return;
                }

                // 唤起锁定，避免重复唤起
                if (locked) {
                    return;
                }
                locked = true;

                var o;
                // 参数容错
                if (typeof params === 'object') {
                    o = params;
                } else {
                    o = {
                        params: params,
                        jumpUrl: jumpUrl
                    };
                }

                // 参数容错
                if (typeof o.params !== 'string') {
                    o.params = '';
                }
                if (typeof o.openAppStore !== 'boolean') {
                    o.openAppStore = true;
                }

                o.params = o.params || 'appId=20000001';
                o.params = o.params + '';
                o.params = o.params + '&_t=' + (new Date() - 0);

                if (o.params.indexOf('startapp?') > -1) {
                    o.params = o.params.split('startapp?')[1];
                } else if (o.params.indexOf('startApp?') > -1) {
                    o.params = o.params.split('startApp?')[1];
                }

                // 是否为RC环境
                var isRc = '';

                // 是否唤起re包
                var isRe = '';
                if (typeof o.isRe === 'undefined') {
                    o.isRe = !!isRe;
                }

                // 通过alipays协议唤起钱包
                var schemePrefix;
                if (ua.indexOf('mac os') > -1 && ua.indexOf('mobile') > -1) {
                    // IOS RC包前缀为 alipaysrc
                    if (isRc) {
                        if (o.isRe) {
                            schemePrefix = 'alipayrerc';
                        } else {
                            schemePrefix = 'alipaysrc';
                        }
                    }
                }
                if (!schemePrefix && o.isRe) {
                    schemePrefix = 'alipayre';
                }
                schemePrefix = schemePrefix || 'alipays';

                // 由于历史原因，对 alipayqr 前缀做特殊处理
                if (href.indexOf('scheme=alipayqr') > -1) {
                    schemePrefix = 'alipayqr';
                    isRc = false;
                }


                if (!canIntent) {

                    var alipaysUrl = schemePrefix + '://platformapi/startapp?' + o.params;

                    if ( ua.indexOf('qq/') > -1 || ( ua.indexOf('safari') > -1 && (ua.indexOf('os 9_') > -1 || ua.indexOf('os 10_') > -1)) ) {
                        var openSchemeLink = document.getElementById('openSchemeLink');
                        if (!openSchemeLink) {
                            openSchemeLink = document.createElement('a');
                            openSchemeLink.id = 'openSchemeLink';
                            openSchemeLink.style.display = 'none';
                            document.body.appendChild(openSchemeLink);
                        }
                        openSchemeLink.href = alipaysUrl;
                        // 执行click
                        openSchemeLink.dispatchEvent(customClickEvent());
                    } else {
                        var ifr = document.createElement('iframe');
                        ifr.src = alipaysUrl;
                        ifr.style.display = 'none';
                        document.body.appendChild(ifr);
                    }



                } else {
                    // android 下 chrome 浏览器通过 intent 协议唤起钱包
                    var packageKey = 'AlipayGphone';
                    if (isRc) {
                        packageKey = 'AlipayGphoneRC';
                    }
                    var intentUrl = 'intent://platformapi/startapp?' + o.params + '#Intent;scheme=' + schemePrefix + ';package=com.eg.android.' + packageKey + ';end';

                    var openIntentLink = document.getElementById('openIntentLink');
                    if (!openIntentLink) {
                        openIntentLink = document.createElement('a');
                        openIntentLink.id = 'openIntentLink';
                        openIntentLink.style.display = 'none';
                        document.body.appendChild(openIntentLink);
                    }
                    openIntentLink.href = intentUrl;
                    // 执行click
                    openIntentLink.dispatchEvent(customClickEvent());
                }

                // 延迟移除用来唤起钱包的IFRAME并跳转到下载页
                setTimeout(function () {
                    if (typeof o.jumpUrl !== 'string') {
                        o.jumpUrl = '';
                    }
                    // 默认跳转地址
                    if (o.jumpUrl === 'default') {
                        o.jumpUrl = 'https://ds.alipay.com/?nojump=true';
                    }

                    if (o.jumpUrl && typeof o.jumpUrl === 'string') {
                        //location.href = o.jumpUrl;
                    }
                }, 1000)


                // 唤起加锁，避免短时间内被重复唤起
                setTimeout(function () {
                    locked = false;
                }, 2500)
            }

            if (!domLoaded) {
                document.addEventListener('DOMContentLoaded', function () {
                    domLoaded = true;
                    if (typeof delayToRun === 'function') {
                        delayToRun();
                    }
                }, false);
            }
        })();
    </script>
    <script type="text/javascript">


        !function (e, t) {
            "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("callapp", [], t) : "object" == typeof exports ? exports.callapp = t() : e.callapp = t()
        }(this, function () {
            return function (e) {
                function t(r) {
                    if (n[r]) return n[r].exports;
                    var i = n[r] = {
                        exports: {},
                        id: r,
                        loaded: !1
                    };
                    return e[r].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports
                }

                var n = {};
                return t.m = e, t.c = n, t.p = "", t(0)
            }([function (e, t) {
                "use strict";

                function n(e, t) {
                    for (var n = e.split("."), r = t.split("."), i = 0; i < n.length || i < r.length; i += 1) {
                        var o = parseInt(n[i], 10) || 0,
                            a = parseInt(r[i], 10) || 0;
                        if (o < a) return -1;
                        if (o > a) return 1
                    }
                    return 0
                }

                function r(e) {
                    v || (v = m.createElement("iframe"), v.id = "callapp_iframe_" + Date.now(), v.frameborder = "0", v.style.cssText = "display:none;border:0;width:0;height:0;", m.body.appendChild(v)), v.src = e
                }

                function i(e) {
                    var t = m.createElement("a");
                    t.setAttribute("href", e), t.style.display = "none", m.body.appendChild(t);
                    var n = m.createEvent("HTMLEvents");
                    n.initEvent("click", !1, !1), t.dispatchEvent(n)
                }

                function o(e) {
                    return /^(http|https)\:\/\//.test(e)
                }

                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                var a = {},
                    c = window.navigator.userAgent,
                    d = !1,
                    s = !1,
                    l = "",
                    p = c.match(/Android[\s\/]([\d\.]+)/);
                p ? (d = !0, l = p[1]) : c.match(/(iPhone|iPad|iPod)/) && (s = !0, p = c.match(/OS ([\d_\.]+) like Mac OS X/), p && (l = p[1].split("_").join(".")));
                var f = !1,
                    u = !1,
                    h = !1;
                c.match(/(?:Chrome|CriOS)\/([\d\.]+)/) ? (f = !0, c.match(/Version\/[\d+\.]+\s*Chrome/) && (h = !0)) : c.match(/iPhone|iPad|iPod/) && (c.match(/Safari/) && c.match(/Version\/([\d\.]+)/) ? u = !0 : c.match(/OS ([\d_\.]+) like Mac OS X/) && (h = !0));
                var m = window.document,
                    v = void 0;
                a.gotoPage = function (e, t, a) {
                    var p = e,
                        m = d && f && !h,
                        v = d && !!c.match(/samsung/i) && n(l, "4.3") >= 0 && n(l, "4.5") < 0,
                        w = s && n(l, "9.0") >= 0 && u;
                    if (m || v || a) {
                        var x = p.substring(0, p.indexOf("://")),
                            g = "#Intent;scheme=" + x + ";package=" + t + ";end";
                        p = p.replace(/.*?:\/\//g, "intent://"), p += g
                    }
                    if (w) {
                        if (o(p)) return window.Tracker && window.Tracker.click && window.Tracker.click("not_schema"), void console.log("not schema");
                        setTimeout(function () {
                            return i(p)
                        }, 100)
                    } else 0 === p.indexOf("intent:") ? setTimeout(function () {
                        return window.location.href = p
                    }, 100) : r(p)
                }, t.default = a, e.exports = t.default
            }])
        });
    </script>


    <script>
        function getAllParams(url) {
            var reg = /[(\?|\&)]([^=]+)\=([^&#]+)/g, matches, output = {};
            while (matches = reg.exec(url)) {
                var key = decodeURIComponent(matches[1]), value = decodeURIComponent(matches[2]);
                output[key] = value;
            }
            return output;
        }

        var isAndroid = false;
        var matched = navigator.userAgent.match(/Android[\s\/]([\d\.]+)/);
        if (matched) {
            isAndroid = true;
        }

        var params = getAllParams(href);
        var scheme = 'alipays://platformapi/startApp?appId=20000001';
        if (params.scheme) {
            scheme = params.scheme;
        }

        var schemeParam = scheme
        schemeParam = schemeParam.replace(/&amp;/ig, '&');


        setTimeout(function () {
            AlipayWallet.open({
                params: schemeParam,
                jumpUrl: ''
            });
            if (isAndroid && /HUAWEI\sMLA-UL00/.test(navigator.userAgent)) {
                callapp.gotoPage(scheme, 'com.eg.android.AlipayGphone', true);
            }
        }, 1000)


    </script>
</body>
</html>

